<?php

abstract class base_controller {
    public $upload ; 
    public $v ;
    public $data = array ();
    protected  $class;
    protected $action  ;
    protected $exception ; 
    public function __set($name, $value) {
        $this->data[$name] = $value;
    }
    public function __get($name) {
        return $this->data[$name];
    }
    public function __construct($class,$session = false ,$sessionPara = NULL, $redirectPara = array()) {
        $this->action = MagicPHP::callMethod()->getViewAction();
        if($session == true) {
            if(key_exists("exception",$redirectPara) && !empty($redirectPara["exception"])) {
                if(is_array($redirectPara["exception"])){
                    if(!in_array($this->action, $redirectPara["exception"])){
                        if(Magic_Session_Lib::callMethod()->_getSession($sessionPara) == 'null') {
                          Magic_Common_Model::callMethod()->_pageRedirect(SITE_URL.$redirectPara["module"]."/".$redirectPara["action"]);
                        }
                    } 
                }
            } else {
                if(Magic_Session_Lib::callMethod()->_getSession($sessionPara) == 'null') {
                  Magic_Common_Model::callMethod()->_pageRedirect(SITE_URL.$redirectPara["module"]."/".$redirectPara["action"]);
                }
            }
        }
        $this->upload = new Magic_ClassUpload_Model;
        if(!empty($class)) {
            $this->upload->uploadClass(array($class));
        }
       
    }
    abstract public function indexController();
 }
?>
